package com.lanou3g.code0427.study;

/**
 * If there are no bugs, it was created by Chen FengYao on 2018/4/27;
 * Otherwise, I don't know who created it either
 */

public class TestAutoClose {
    public static void main(String[] args) {
        /*
        try 在1.7之后 可以在小括号内创建对象,并且 不写分号
        当try执行完毕后,会自动关闭资源
        (这个对象需要实现AutoCloseable接口)
         */
        try(Foo foo = new Foo()) {
            foo.fun();
        }catch (Exception e){
            e.printStackTrace();
        }
    }
}
